<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 在线考试系统</title>
    <link rel="stylesheet" href="__VIEW__css/style.css">
    <script src="__VIEW__js/jquery.min.js"></script>
    <script src="__VIEW__js/jquery.timeout.js"></script>
    <style>
        .top  .top-title .top-back{
            float: left;
            display: inline-block;
            position: absolute;
            left: 20px;
            width: 60px;
            margin-top: 0;
            margin-left: 20px;
            font-size: 20px;
        }
        .top  .top-title .top-back:hover{
            cursor: pointer;
        }
        .top .top-title {
            float: right;
            margin-right: 50px;
            font-size: 20px;
        }
        .top .top-title #time{
            display: inline-block;
        }

    </style>

</head>
<body>
<div class="top">
    <div class="top-title">剩余时间:&nbsp;<div id="time"></div>
    <p class="top-back" href="javascript:void(0)">返回</p></div>

</div>
<div class="main">
    <div class="main-wrap">
        <!-- 顶部标题 -->
        <div class="question-top">
            <!-- 试卷标题 -->
            <!-- 题型导航 -->
        </div>
        <!-- 题目内容 -->
        <form action="{:url('Forms/doAddform')}" method="post" id="testForm">
            <!-- 判断题 -->
            <div class="question-wrap">
            <!-- 单选题 -->
            <div id="single" class="anchor" ></div>
            <div class="question-wrap">
                <div class="question-type">单选题<span>（共20题，每题5分）</span></div>
                <div class="question-each">
                    <!-- 标题 -->
                    {volist name="questionList" id="question" empty= "$emptyHtml" }
                    <div class="question-name">{$key+1}.&nbsp;&nbsp;{$question.question}</div>
                    <!-- 选项 -->
                    <div class="question-option">
                        <label><input type="radio" name="{$key}" value="A" id="radiogroup1_0" >A </label>
                        <label><input type="radio" name="{$key}" value="B" id="radiogroup1_1">B</label>
                        <label><input type="radio" name="{$key}" value="C" id="radiogroup1_2">C</label>
                        <label><input type="radio" name="{$key}" value="D" id="radiogroup1_3">D</label>
                    </div>

                    {/volist}
                </div>

            </div>
            <div class="question-act">
                <input type="submit" value="交卷" >
            </div>
        </form>
    </div>
</div>


<script tpye="text/javascript">
    $(".top-back").click(function () {
        var message = confirm('是否退出考试？');
        if(message == true){
            window.history.back(-1);
        }
    })
</script>

<script>
    var times = 3 * 60;//剩余时间,单位秒
    var timeDiv = document.getElementById("time");
    var timeObj = null;
    function timer(){
        if(times == 0){
            //倒计时结束，提交表单
            document.getElementById("frm").submit();
            window.clearInterval(timeObj);
            return;
        }
        var t = Math.floor(times/60) +"分"+times%60+"秒"
        timeDiv.innerHTML = t;
        times --;
    }
    timeObj = window.setInterval(timer,1000);
</script>
</body>
</html>